<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>codefish的个人博客</title>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/cl-css.css" rel="stylesheet">
    <link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/highlight/styles/railscasts.css">
    <link rel="stylesheet" href="/css/common.css">
</head>
<body>
<!--导航栏-->
<div th:replace="component/componet-navbar::componet-navbar (${1})"></div>

<div class="cl-cantainer container">
    <div class="row">
        <!--        首页主要内容-->
        <div class="col-md-9 cl-left">
            <!--           推荐列-->
            <div class="recommend-index" th:if="${nowPage==1}">

                <div class="recommend-top">
                    <!--                    图片轮播-->
                    <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                        <ol class="carousel-indicators">
                            <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                        </ol>
                        <!--                        轮播内容-->
                        <div class="carousel-inner">
                            <div class="carousel-item active">
                                <a href="#"
                                   th:href="@{/article/{articleId}(articleId=${articleSnapshots.get(0).articleId})}">
                                    <img class="d-block w-100" src="/temporary-img/recommended.jpg"
                                         th:src="@{/file/{fileId}(fileId=${articleSnapshots.get(0).articleCover})}"
                                         alt="First slide" height="370px" width="100%" style="object-fit: cover">
                                </a>
                                <span th:text="${articleSnapshots.get(0).articleTitle}"
                                      style="position: absolute;top:80%;width:100%;text-align: center;z-index: 1000;color: cornflowerblue;font-size: larger;font-weight: bolder">
                                   Java学习笔记
                               </span>
                            </div>
                            <div class="carousel-item">
                                <a href="#"
                                   th:href="@{/article/{articleId}(articleId=${articleSnapshots.get(1).articleId})}">
                                    <img class="d-block w-100" src="/temporary-img/recommended.jpg"
                                         th:src="@{/file/{fileId}(fileId=${articleSnapshots.get(1).articleCover})}"
                                         alt="Second slide" height="370px" width="100%" style="object-fit: cover"/>
                                </a>
                                <span th:text="${articleSnapshots.get(1).articleTitle}"
                                      style="position: absolute;top:80%;width:100%;text-align: center;z-index: 1000;color: cornflowerblue;font-size: larger;font-weight: bolder">
                                   Java学习笔记
                               </span>
                            </div>
                            <div class="carousel-item">
                                <a href="#"
                                   th:href="@{/article/{articleId}(articleId=${articleSnapshots.get(2).articleId})}">
                                    <img class="d-block w-100" src="/temporary-img/recommended.jpg"
                                         th:src="@{/file/{fileId}(fileId=${articleSnapshots.get(2).articleCover})}"
                                         alt="Third slide" height="370px" width="100%" style="object-fit: cover"/>
                                </a>
                                <span th:text="${articleSnapshots.get(2).articleTitle}"
                                      style="position: absolute;top:80%;width:100%;text-align: center;z-index: 1000;color: cornflowerblue;font-size: larger;font-weight: bolder">
                                   Java学习笔记
                               </span>
                            </div>
                        </div>
                        <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button"
                           data-slide="prev">
                            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                            <span class="sr-only">Previous</span>
                        </a>
                        <a class="carousel-control-next" href="#carouselExampleIndicators" role="button"
                           data-slide="next">
                            <span class="carousel-control-next-icon" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
                    </div>
                </div>
                <!--                推荐列表-->
                <div class="recommend-bottom">
                    <div class="recommend-item">
                        <a href="../static/js/blog-details.html"
                           th:href="@{/article/{articleId}(articleId=${articleSnapshots.get(3).articleId})}">
                            <img src="/temporary-img/recommended-left.jpg" style="height: 200px; object-fit: cover"
                                 class="img-fluid" alt=""
                                 th:src="@{/file/{fileId}(fileId=${articleSnapshots.get(3).articleCover})}"></a>
                    </div>
                    <div class="recommend-item">
                        <a href="../static/js/blog-details.html"
                           th:href="@{/article/{articleId}(articleId=${articleSnapshots.get(4).articleId})}">
                            <img src="/temporary-img/recommended-left.jpg" style="height:200px;object-fit: cover"
                                 class="img-fluid" alt=""
                                 th:src="@{/file/{fileId}(fileId=${articleSnapshots.get(4).articleCover})}"></a>
                    </div>
                </div>

            </div>
            <!--             文章列表-->
            <div class="cl-card" th:each="item : ${articleSnapshots}"
                 th:if="${!(nowPage==1&&itemStat.index<5)}"><!-- 若页数为1,则跳过前5项,因为在图片轮播和图片推荐处已加载-->
                <div class="row">
                    <div class="col-lg-3 col-md-4 col-sm-12 cl-card-image"><a href="#"
                                                                              th:href="@{/article/{articleId}(articleId=${item.articleId})}">
                        <img th:src="@{/file/{fileId}(fileId=${item.articleCover})}"
                             src="temporary-img/article_page1.jpg" class="img-fluid" alt="">
                    </a></div>
                    <div class="col-lg-9 col-md-8 col-sm-12 cl-card-main">
                        <h3 class="cl-card-main-title"><a href="../static/js/blog-details.html"
                                                          th:href="@{/article/{articleId}(articleId=${item.articleId})}"
                                                          th:text="${item.articleTitle}">文章标题</a>
                        </h3>
                        <p class="cl-card-main-info" th:text="${item.articleIntroduction}">文章简介</p>
                        <p class="cl-card-more"><a href="../static/js/blog-details.html"
                                                   th:href="@{/article/{articleId}(articleId=${item.articleId})}">阅读更多...</a>
                        </p>
                    </div>
                </div>
            </div>

            <!--            分页标签-->
            <nav aria-label="Page navigation example">
                <ul class="pagination justify-content-center">
                    <li class="page-item" th:class="${nowPage==1}? 'page-item disabled':'page-item'">
                        <a class="page-link" th:href="@{/(page=${nowPage}-1)}" aria-label="Previous">
                            <span aria-hidden="true">«</span>
                            <span class="sr-only">Previous</span>
                        </a>
                    </li>
                    <li class="page-item active" th:class="${nowPage==i}? 'page-item active':'page-item' "
                        th:each="i : ${#numbers.sequence(1,totalPage)}">
                        <a class="page-link" href="#" th:href="@{/(page=${i})}" th:text="${i}">1</a>
                    </li>

                    <li class="page-item" th:class="${nowPage==totalPage}? 'page-item disabled':'page-item'">
                        <a class="page-link" th:href="@{/(page=${nowPage}+1)}" href="#" aria-label="Next">
                            <span aria-hidden="true">»</span>
                            <span class="sr-only">Next</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <!--        侧边栏-->
        <div th:replace="component/component-sidebar::component-sidebar"></div>
    </div>
</div>
<!--页脚-->
<div th:replace="component/component-footer::component-footer"></div>

<script src="/jquery/jquery.min.js"></script>
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/highlight/highlight.pack.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>
<script src="/js/common.js"></script>
</body>
</html>
